import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

import piniaPersistedState from "pinia-plugin-persistedstate"

import 'normalize.css'

import '@/assets/styles/common.less'

import plugin from "@/utils/plugin"



const app = createApp(App)
const pinia = createPinia()
app.use(createPinia())
app.use(router)

pinia.use(piniaPersistedState)
app.use(pinia)
app.use(plugin)
app.mount('#app')


//启动请求拦截程序
//判断当前是否是开发环境
if (process.env.NODE_ENV === "development") {
    //动态导入worker
    const worker = require("./mocks/browser").default;
    // onUnhandledRequest: "bypass"
    // 绕过未拦截的请求, 不要发出警告
    // quiet: true
    // 安静模式, 对于拦截成功的请求不要在控制台中进行输出提示
    //开启请求拦截成功
    worker.start({ onUnhandledRequest: "bypass", quiet: true })
}